<Window x:Class="SalesPoint.Views.ProductItemView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="290"
        MinHeight="290"
        Width="700"
        MinWidth="700">
    <DockPanel LastChildFill="False">
        <GroupBox DockPanel.Dock="Top"
            Name="GroupBox"
                  Margin="16, 10, 16, 16"
                  Header="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=Title}">
            <Grid Margin="10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="10"></ColumnDefinition>
                    <ColumnDefinition Width="150"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="26"></RowDefinition>
                    <RowDefinition Height="26"></RowDefinition>
                    <RowDefinition Height="26"></RowDefinition>
                    <RowDefinition Height="26"></RowDefinition>
                    <RowDefinition Height="26"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.Resources>
                    <ResourceDictionary>
                        <ResourceDictionary.MergedDictionaries>
                            <ResourceDictionary Source="../Resources/ItemEditorStyles.xaml" />
                            <ResourceDictionary Source="../Resources/Converters.xaml" />
                        </ResourceDictionary.MergedDictionaries>
                    </ResourceDictionary>
                </Grid.Resources>
                <Label Grid.Row="0"
                       Grid.Column="0">Id</Label>
                <Label Grid.Row="1"
                       Grid.Column="0">Product Name</Label>
                <Label Grid.Row="2"
                       Grid.Column="0">Supplier</Label>
                <Label Grid.Row="3"
                       Grid.Column="0">Category</Label>
                <Label Grid.Row="4"
                       Grid.Column="0">Is Discontinued</Label>

                <Label Grid.Row="0"
                       Grid.Column="3">Unit Price</Label>
                <Label Grid.Row="1"
                       Grid.Column="3">Units In Stock</Label>
                <Label Grid.Row="2"
                       Grid.Column="3">Units On Order</Label>
                <Label Grid.Row="3"
                       Grid.Column="3">Reorder Level</Label>
                <Label Grid.Row="4"
                       Grid.Column="3">Quantity Per Unit</Label>

                <TextBox Grid.Row="0"
                         Grid.Column="1"
                         Text="{Binding Path=Item.Id, Mode=OneWay}"
                         IsReadOnly="True"></TextBox>
                <TextBox Grid.Row="1"
                         Grid.Column="1"
                         Text="{Binding Path=Item.ProductName}"></TextBox>
                <ComboBox Grid.Row="2"
                          Grid.Column="1"
                          ItemsSource="{Binding Suppliers}"
                          DisplayMemberPath="CompanyName"
                          SelectedValue="{Binding Path=Item.Supplier}"></ComboBox>
                <ComboBox Grid.Row="3"
                          Grid.Column="1"
                          ItemsSource="{Binding Categories}"
                          DisplayMemberPath="CategoryName"
                          SelectedValue="{Binding Path=Item.Category}"></ComboBox>
                <CheckBox Grid.Row="4"
                          Grid.Column="1"
                          IsChecked="{Binding Path=Item.ProductType, Converter={StaticResource ProductTypeToBoolConverter}}"></CheckBox>

                <TextBox Grid.Row="0"
                         Grid.Column="4"
                         Text="{Binding Path=Item.UnitPrice, StringFormat=f}"></TextBox>
                <TextBox Grid.Row="1"
                         Grid.Column="4"
                         Text="{Binding Path=Item.UnitsInStock}"></TextBox>
                <TextBox Grid.Row="2"
                         Grid.Column="4"
                         Text="{Binding Path=Item.UnitsOnOrder}"></TextBox>
                <TextBox Grid.Row="3"
                         Grid.Column="4"
                         Text="{Binding Path=Item.ReorderLevel}"></TextBox>
                <TextBox Grid.Row="4"
                         Grid.Column="4"
                         Text="{Binding Path=Item.QuantityPerUnit}"></TextBox>
            </Grid>
        </GroupBox>
        <StackPanel Orientation="Horizontal"
                    DockPanel.Dock="Bottom"
                    HorizontalAlignment="Right"
                    Margin="16,0,16,16">
            <StackPanel.Resources>
                <Style TargetType="Button">
                    <Setter Property="Width"
                            Value="80" />
                    <Setter Property="Height"
                            Value="30" />
                    <Setter Property="Margin"
                            Value="10,0,0,0" />
                </Style>
            </StackPanel.Resources>
            <Button IsDefault="True"
                    Click="OKClick">OK</Button>
            <Button IsCancel="True">Cancel</Button>
        </StackPanel>
    </DockPanel>
</Window>
